import request from "@/utils/request";
/**
 *
 * @param {*} params
 * @returns 员工列表
 */
export function staffList(params) {
  return request({
    url: "/staff/listVO",
    method: "post",
    data: params,
  });
}

/**
 * 统计新人
 * @returns 
 */
export function totalByNewStaff(component) {
  return request({
    url: "/staff/totalByNewStaff",
    method: "post",
    data: {},
  }).then(res => {

    component.normal = res.data.nomarl;

    component.newStaff = res.data.newStaff;

  });
}

/**
 * 搜索统计新人
 * @returns 
 */
export function totalByNewStaffBySearch(param, component) {
  return request({
    url: "/staff/totalByNewStaffBySearch",
    method: "post",
    data: param,
  }).then(res => {

    component.normal = res.data.nomarlSearch;

    component.newStaff = res.data.newStaffSearch;

  });
}

/**
 * 获取员工派单统计
 */
export function getStatisticsVisitStaffVOs(param, component) {

  return request({
    url: "/statisticsStaffNum/getStatisticsVisitStaffVOs",
    method: "post",
    data: param,
  }).then(response => {
    component.listLoading = false;
    component.list = response.data.data;
    component.total = response.data.total;
    component.pageSize = response.data.pageSize;
    component.sortList();
    return response;
  });

}
export function getStatisticsVisitStaffVOsBySearch(param, component) {

  return request({
    url: "/statisticsStaffNum/getStatisticsVisitStaffVOsBySearch",
    method: "post",
    data: param,
  }).then(response => {
    component.listLoading = false;
    component.list = response.data.data;
    component.total = response.data.total;
    component.pageSize = response.data.pageSize;
    component.sortList();
    return response;
  });

}


/**
 *
 * @param {*} params
 * @returns 搜索员工
 */
export function staffListSearch(params) {
  return request({
    url: "/staff/listBySearchVO",
    method: "post",
    data: params,
  });
}

/**
 *
 * @param {*} params
 * @returns 更新员工
 */
export function updateStaff(params) {
  return request({
    url: "/staff/update",
    method: "post",
    data: params,
  });
}

/**
 *
 * @param {*} params
 * @returns 添加员工
 */
export function addStaff(params) {
  return request({
    url: "/staff/add",
    method: "post",
    data: params,
  });
}

/**
 *
 * @param {*} params
 * @returns 获取省份
 */
export function getArea(params) {
  return request({
    url: "/region/regionsByParentId",
    method: "post",
    data: params,
  });
}

export function getAlreadyExist(component) {
  return request({
    url: "/region/getAlreadyExist",
    method: "post",
  }).then(res => {

   
    component.areas = res.data;

  });
}


/**
 *
 * @param {*} params
 * @returns 获取市区
 */
export function getUrban(params) {
  return request({
    url: "/region/regionsByProvinceId",
    method: "post",
    data: params,
  });
}
